package com.lord.wand.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lord.wand.dao.UserDao;
import com.lord.wand.entity.User;
import com.lord.wand.service.IUserService;

@Service
public class UserServiceImpl implements IUserService {

	@Autowired
	private UserDao userDao;

	@Override
	public User getUserById(Integer id) {
		if (id != null) {
			User dbUser = userDao.getOne(id);
			return dbUser;
		}
		return null;
	}

	@Override
	public List<User> getUserList(User model) {
		return userDao.findAll();
	}

	@Override
	public User add(User user) {
		return userDao.save(user);
	}

}
